<?php

/**
 * @Description    
 * @Author         zhaojiping
 * @Copyright      山东艾思软件科技有限公司(https://www.aisisofit.cn)
 * @Date           2022-6-15
 * @CreateBy       vs code
 */


namespace app\base\controller;

use app\base\model\BaseLog;
use app\base\validate\BaseLog as ValidateBaseLog;
use app\BaseController;
use app\common\controller\CommonController;

class LogController extends CommonController {

    protected $model = null;
    protected $validate = null;

    /**
     * 初始化
     */
    public function initialize() {
        parent::initialize();
        $this->model = new BaseLog();
        $this->validate = new ValidateBaseLog;
    }


    /**
     * 获取数据列表
     */
    public function lists() {
        $keyword = input('keyword', '');
        $where = [];
        if ($keyword != '') $where[] = ['title|content', 'like', "%$keyword%"];
        $data = $this->model->getPageList($where);
        json_return(1, '数据列表', $data);
    }

    /**
     * 家庭资料修改记录
     */
    public function cmsFamilyRecords() {
        $familyId = input('family_id/d', 0);
        $keyword = input('keyword', '');
        $where = [
            ['table_name', '=', "cms_family"]
        ];
        if ($familyId > 0) $where[] = ['row_id', '=', $familyId];
        if ($keyword != '') $where[] = ['title|content', 'like', "%$keyword%"];
        $data = $this->model->getPageList($where);
        // return json($data);
        json_return(1, '数据列表', $data);
    }

    /**
     * 客户资料修改记录
     */
    public function cmsCustomerRecords() {
        $customerId = input('customer_id/d', 0);
        $keyword = input('keyword', '');
        $where = [
            ['table_name', '=', "cms_customer"]
        ];
        if ($customerId > 0) $where[] = ['row_id', '=', $customerId];
        if ($keyword != '') $where[] = ['title|content', 'like', "%$keyword%"];
        $data = $this->model->getPageList($where);
        json_return(1, '数据列表', $data);
    }
}
